﻿<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="../JS/jquery.js"></script>
<script src="../JS/getcookie.js" ></script>
<script>
$(document).ready(function(){

	$("div").css("display","inline-block");
	$("p").css("display","inline-block");
	$("form").css("display","inline-block");
	
	if( getCookie("name") != "" )
	{
		parent.location = 'index.htm';
	}
	
	$("#login").click(function(){
		var nameStr = $("#name")[0].value;
		var passwordStr = $("#password")[0].value;
		$.post("../PHP/chkuser.php",
		{
			name:nameStr,
			password:passwordStr
		},
		function(data){
			if( data == "ok" )
			{
				setCookie("name",nameStr,7);
				parent.location = 'index.htm';
			}
			else if(data == "not active")
			{
				alert("请通过邮件激活该账号，或者再次点击发送激活邮件。");
			}
			else
			{
				alert("登录错误\n"+data);
			}
		});
	});

});
</script> 
</head>
 
<body>

<div>
	<p>用户名：</p>
	<input type="text" id="name" />
	<div id="nametip"></div>
</div> <br/>

<div>
	<p>密&nbsp;&nbsp;码：</p>
	<input type="password" id="password"/>
	<div id="passwordtip"></div>
</div> <br/>

<div>
	<input type="button" value="登录" id="login" />
	<div id="output"></div>
	<a name = "bottom" />
</div>
</body>
</html>